home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / DirectPlay / VoiceGroup / frmVoiceSettings.frm < prev    next >
Text File  |  2001-10-08  |  18KB  |  510 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form frmVoiceSettings 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Direct Play Voice Settings"
  6.    ClientHeight    =   5010
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   5835
  10.    Icon            =   "frmVoiceSettings.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   5010
  15.    ScaleWidth      =   5835
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin VB.CommandButton cmdOk 
  18.       Caption         =   "OK"
  19.       Default         =   -1  'True
  20.       Height          =   375
  21.       Left            =   4545
  22.       TabIndex        =   36
  23.       Top             =   4545
  24.       Width           =   1215
  25.    End
  26.    Begin VB.CommandButton cmdCancel 
  27.       Cancel          =   -1  'True
  28.       Caption         =   "Cancel"
  29.       Height          =   375
  30.       Left            =   3255
  31.       TabIndex        =   35
  32.       Top             =   4545
  33.       Width           =   1215
  34.    End
  35.    Begin VB.Frame fraServer 
  36.       Caption         =   "Server Options (set only when creating a new session) "
  37.       Height          =   1020
  38.       Left            =   60
  39.       TabIndex        =   1
  40.       Top             =   3420
  41.       Width           =   5700
  42.       Begin VB.Frame fraCompression 
  43.          Caption         =   " Compression Codec "
  44.          Height          =   660
  45.          Left            =   120
  46.          TabIndex        =   33
  47.          Top             =   240
  48.          Width           =   5475
  49.          Begin VB.ComboBox cboCompressionTypes 
  50.             Height          =   315
  51.             Left            =   135
  52.             Style           =   2  'Dropdown List
  53.             TabIndex        =   34
  54.             Top             =   255
  55.             Width           =   5220
  56.          End
  57.       End
  58.    End
  59.    Begin VB.Frame Frame1 
  60.       Caption         =   "Client Options (may be adjusted at any time) "
  61.       Height          =   3195
  62.       Left            =   60
  63.       TabIndex        =   0
  64.       Top             =   60
  65.       Width           =   5715
  66.       Begin VB.Frame Frame3 
  67.          Caption         =   " Aggressiveness "
  68.          Height          =   1335
  69.          Index           =   4
  70.          Left            =   3000
  71.          TabIndex        =   27
  72.          Top             =   1740
  73.          Width           =   1755
  74.          Begin VB.OptionButton optAggressivenessSet 
  75.             Caption         =   "Set"
  76.             Height          =   255
  77.             Left            =   1020
  78.             TabIndex        =   29
  79.             Top             =   300
  80.             Width           =   675
  81.          End
  82.          Begin VB.OptionButton optAgressivenessDefault 
  83.             Caption         =   "Default"
  84.             Height          =   195
  85.             Left            =   60
  86.             TabIndex        =   28
  87.             Top             =   300
  88.             Value           =   -1  'True
  89.             Width           =   855
  90.          End
  91.          Begin MSComctlLib.Slider sldAggressiveness 
  92.             Height          =   195
  93.             Left            =   60
  94.             TabIndex        =   30
  95.             Top             =   780
  96.             Width           =   1635
  97.             _ExtentX        =   2884
  98.             _ExtentY        =   344
  99.             _Version        =   393216
  100.             Min             =   1
  101.             Max             =   100
  102.             SelStart        =   1
  103.             TickFrequency   =   10
  104.             Value           =   1
  105.          End
  106.          Begin VB.Label Label1 
  107.             BackStyle       =   0  'Transparent
  108.             Caption         =   "Max"
  109.             Height          =   195
  110.             Index           =   9
  111.             Left            =   1320
  112.             TabIndex        =   32
  113.             Top             =   1080
  114.             Width           =   315
  115.          End
  116.          Begin VB.Label Label1 
  117.             BackStyle       =   0  'Transparent
  118.             Caption         =   "Min"
  119.             Height          =   195
  120.             Index           =   8
  121.             Left            =   60
  122.             TabIndex        =   31
  123.             Top             =   1080
  124.             Width           =   315
  125.          End
  126.       End
  127.       Begin VB.Frame Frame3 
  128.          Caption         =   " Quality "
  129.          Height          =   1335
  130.          Index           =   3
  131.          Left            =   1020
  132.          TabIndex        =   21
  133.          Top             =   1740
  134.          Width           =   1755
  135.          Begin VB.OptionButton optQualityDefault 
  136.             Caption         =   "Default"
  137.             Height          =   195
  138.             Left            =   60
  139.             TabIndex        =   24
  140.             Top             =   300
  141.             Value           =   -1  'True
  142.             Width           =   855
  143.          End
  144.          Begin VB.OptionButton OptQualitySet 
  145.             Caption         =   "Set"
  146.             Height          =   255
  147.             Left            =   1020
  148.             TabIndex        =   23
  149.             Top             =   300
  150.             Width           =   675
  151.          End
  152.          Begin MSComctlLib.Slider sldQuality 
  153.             Height          =   195
  154.             Left            =   60
  155.             TabIndex        =   22
  156.             Top             =   780
  157.             Width           =   1635
  158.             _ExtentX        =   2884
  159.             _ExtentY        =   344
  160.             _Version        =   393216
  161.             Min             =   1
  162.             Max             =   100
  163.             SelStart        =   1
  164.             TickFrequency   =   10
  165.             Value           =   1
  166.          End
  167.          Begin VB.Label Label1 
  168.             BackStyle       =   0  'Transparent
  169.             Caption         =   "Min"
  170.             Height          =   195
  171.             Index           =   7
  172.             Left            =   60
  173.             TabIndex        =   26
  174.             Top             =   1080
  175.             Width           =   315
  176.          End
  177.          Begin VB.Label Label1 
  178.             BackStyle       =   0  'Transparent
  179.             Caption         =   "Max"
  180.             Height          =   195
  181.             Index           =   6
  182.             Left            =   1320
  183.             TabIndex        =   25
  184.             Top             =   1080
  185.             Width           =   315
  186.          End
  187.       End
  188.       Begin VB.Frame Frame3 
  189.          Caption         =   "Threshold"
  190.          Height          =   1335
  191.          Index           =   2
  192.          Left            =   3840
  193.          TabIndex        =   14
  194.          Top             =   300
  195.          Width           =   1755
  196.          Begin VB.OptionButton optSensitivityDefault 
  197.             Caption         =   "Default"
  198.             Height          =   255
  199.             Left            =   840
  200.             TabIndex        =   17
  201.             Top             =   300
  202.             Width           =   855
  203.          End
  204.          Begin VB.OptionButton optnSensitivityAuto 
  205.             Caption         =   "Auto"
  206.             Height          =   195
  207.             Left            =   60
  208.             TabIndex        =   16
  209.             Top             =   300
  210.             Value           =   -1  'True
  211.             Width           =   735
  212.          End
  213.          Begin VB.OptionButton optSensitivitySet 
  214.             Caption         =   "Set"
  215.             Height          =   255
  216.             Left            =   420
  217.             TabIndex        =   15
  218.             Top             =   540
  219.             Width           =   855
  220.          End
  221.          Begin MSComctlLib.Slider sldSensitivity 
  222.             Height          =   195
  223.             Left            =   60
  224.             TabIndex        =   18
  225.             Top             =   780
  226.             Width           =   1635
  227.             _ExtentX        =   2884
  228.             _ExtentY        =   344
  229.             _Version        =   393216
  230.             Max             =   99
  231.             TickFrequency   =   10
  232.          End
  233.          Begin VB.Label Label1 
  234.             BackStyle       =   0  'Transparent
  235.             Caption         =   "Max"
  236.             Height          =   195
  237.             Index           =   5
  238.             Left            =   1320
  239.             TabIndex        =   20
  240.             Top             =   1080
  241.             Width           =   315
  242.          End
  243.          Begin VB.Label Label1 
  244.             BackStyle       =   0  'Transparent
  245.             Caption         =   "Min"
  246.             Height          =   195
  247.             Index           =   4
  248.             Left            =   60
  249.             TabIndex        =   19
  250.             Top             =   1080
  251.             Width           =   315
  252.          End
  253.       End
  254.       Begin VB.Frame Frame3 
  255.          Caption         =   " Record Volume "
  256.          Height          =   1335
  257.          Index           =   1
  258.          Left            =   1980
  259.          TabIndex        =   7
  260.          Top             =   300
  261.          Width           =   1755
  262.          Begin VB.OptionButton optRecordSet 
  263.             Caption         =   "Set"
  264.             Height          =   255
  265.             Left            =   420
  266.             TabIndex        =   13
  267.             Top             =   540
  268.             Width           =   855
  269.          End
  270.          Begin VB.OptionButton optRecordAuto 
  271.             Caption         =   "Auto"
  272.             Height          =   195
  273.             Left            =   60
  274.             TabIndex        =   10
  275.             Top             =   300
  276.             Value           =   -1  'True
  277.             Width           =   735
  278.          End
  279.          Begin VB.OptionButton optRecordDefault 
  280.             Caption         =   "Default"
  281.             Height          =   255
  282.             Left            =   840
  283.             TabIndex        =   9
  284.             Top             =   300
  285.             Width           =   855
  286.          End
  287.          Begin MSComctlLib.Slider sldRecord 
  288.             Height          =   195
  289.             Left            =   60
  290.             TabIndex        =   8
  291.             Top             =   780
  292.             Width           =   1635
  293.             _ExtentX        =   2884
  294.             _ExtentY        =   344
  295.             _Version        =   393216
  296.             LargeChange     =   500
  297.             SmallChange     =   100
  298.             Min             =   -10000
  299.             Max             =   0
  300.             TickFrequency   =   1000
  301.          End
  302.          Begin VB.Label Label1 
  303.             BackStyle       =   0  'Transparent
  304.             Caption         =   "Min"
  305.             Height          =   195
  306.             Index           =   3
  307.             Left            =   60
  308.             TabIndex        =   12
  309.             Top             =   1080
  310.             Width           =   315
  311.          End
  312.          Begin VB.Label Label1 
  313.             BackStyle       =   0  'Transparent
  314.             Caption         =   "Max"
  315.             Height          =   195
  316.             Index           =   2
  317.             Left            =   1320
  318.             TabIndex        =   11
  319.             Top             =   1080
  320.             Width           =   315
  321.          End
  322.       End
  323.       Begin VB.Frame Frame3 
  324.          Caption         =   " Playback Volume "
  325.          Height          =   1335
  326.          Index           =   0
  327.          Left            =   120
  328.          TabIndex        =   2
  329.          Top             =   300
  330.          Width           =   1755
  331.          Begin VB.OptionButton optVolumeSet 
  332.             Caption         =   "Set"
  333.             Height          =   255
  334.             Left            =   1020
  335.             TabIndex        =   4
  336.             Top             =   300
  337.             Width           =   675
  338.          End
  339.          Begin VB.OptionButton optVolumeDefault 
  340.             Caption         =   "Default"
  341.             Height          =   195
  342.             Left            =   60
  343.             TabIndex        =   3
  344.             Top             =   300
  345.             Value           =   -1  'True
  346.             Width           =   855
  347.          End
  348.          Begin MSComctlLib.Slider sldVolume 
  349.             Height          =   195
  350.             Left            =   60
  351.             TabIndex        =   37
  352.             Top             =   780
  353.             Width           =   1635
  354.             _ExtentX        =   2884
  355.             _ExtentY        =   344
  356.             _Version        =   393216
  357.             LargeChange     =   500
  358.             SmallChange     =   100
  359.             Min             =   -10000
  360.             Max             =   0
  361.             TickFrequency   =   1000
  362.          End
  363.          Begin VB.Label Label1 
  364.             BackStyle       =   0  'Transparent
  365.             Caption         =   "Max"
  366.             Height          =   195
  367.             Index           =   1
  368.             Left            =   1320
  369.             TabIndex        =   6
  370.             Top             =   1080
  371.             Width           =   315
  372.          End
  373.          Begin VB.Label Label1 
  374.             BackStyle       =   0  'Transparent
  375.             Caption         =   "Min"
  376.             Height          =   195
  377.             Index           =   0
  378.             Left            =   60
  379.             TabIndex        =   5
  380.             Top             =   1080
  381.             Width           =   315
  382.          End
  383.       End
  384.    End
  385. End
  386. Attribute VB_Name = "frmVoiceSettings"
  387. Attribute VB_GlobalNameSpace = False
  388. Attribute VB_Creatable = False
  389. Attribute VB_PredeclaredId = True
  390. Attribute VB_Exposed = False
  391. Option Explicit
  392. Option Compare Text
  393. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  394. '
  395. '  Copyright (C) 1999-2001 Microsoft Corporation.  All Rights Reserved.
  396. '
  397. '  File:       frmVoiceSettings.frm
  398. '
  399. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  400.  
  401. Private Sub cmdCancel_Click()
  402.     fGotSettings = False
  403.     Unload Me
  404. End Sub
  405.  
  406. Private Sub cmdOk_Click()
  407.     fGotSettings = True
  408.     'Setup up the clients stuff
  409.     If optAgressivenessDefault.Value Then
  410.         oClient.lBufferAggressiveness = DVBUFFERAGGRESSIVENESS_DEFAULT
  411.         oSession.lBufferAggressiveness = DVBUFFERAGGRESSIVENESS_DEFAULT
  412.     Else
  413.         oClient.lBufferAggressiveness = sldAggressiveness.Value
  414.         oSession.lBufferAggressiveness = sldAggressiveness.Value
  415.     End If
  416.     If optQualityDefault Then
  417.         oClient.lBufferQuality = DVBUFFERQUALITY_DEFAULT
  418.         oSession.lBufferQuality = DVBUFFERQUALITY_DEFAULT
  419.     Else
  420.         oClient.lBufferQuality = sldQuality.Value
  421.         oSession.lBufferQuality = sldQuality.Value
  422.     End If
  423.     If optnSensitivityAuto.Value Then
  424.         oClient.lThreshold = DVTHRESHOLD_UNUSED
  425.     ElseIf optSensitivitySet Then
  426.         oClient.lThreshold = sldSensitivity.Value
  427.         oClient.lFlags = oClient.lFlags Or DVCLIENTCONFIG_MANUALVOICEACTIVATED
  428.     ElseIf optSensitivityDefault.Value Then
  429.         oClient.lThreshold = DVTHRESHOLD_DEFAULT
  430.         oClient.lFlags = oClient.lFlags Or DVCLIENTCONFIG_MANUALVOICEACTIVATED
  431.     End If
  432.     If optRecordAuto.Value Then
  433.         oClient.lFlags = oClient.lFlags Or DVCLIENTCONFIG_AUTOVOICEACTIVATED
  434.     ElseIf optRecordDefault.Value Then
  435.         oClient.lRecordVolume = 0
  436.     ElseIf optRecordSet.Value Then
  437.         oClient.lRecordVolume = sldRecord.Value
  438.     End If
  439.     If optVolumeDefault Then
  440.         oClient.lPlaybackVolume = DVPLAYBACKVOLUME_DEFAULT
  441.     ElseIf optVolumeSet Then
  442.         oClient.lPlaybackVolume = sldVolume.Value
  443.     End If
  444.     oClient.lNotifyPeriod = 0
  445.     'Now set up the server stuff
  446.     oSession.lSessionType = DVSESSIONTYPE_PEER
  447.     
  448.     Dim oData As DVCOMPRESSIONINFO
  449.     dvServer.GetCompressionType cboCompressionTypes.ListIndex + 1, oData, 0
  450.     oSession.guidCT = oData.guidType
  451.     
  452.     Unload Me
  453. End Sub
  454.  
  455. Public Sub ClientOnly()
  456.     fraServer.Enabled = False
  457.     fraCompression.Enabled = False
  458. End Sub
  459.  
  460. Private Sub Form_Load()
  461.     Dim lIndex As Long
  462.  
  463.     'Set up the defaults
  464.     sldAggressiveness.Min = DVBUFFERAGGRESSIVENESS_MIN
  465.     sldAggressiveness.Max = DVBUFFERAGGRESSIVENESS_MAX
  466.     sldAggressiveness.LargeChange = (DVBUFFERAGGRESSIVENESS_MAX - DVBUFFERAGGRESSIVENESS_MIN) \ 10
  467.     sldAggressiveness.TickFrequency = sldAggressiveness.LargeChange
  468.     
  469.     sldQuality.Min = DVBUFFERQUALITY_MIN
  470.     sldQuality.Max = DVBUFFERQUALITY_MAX
  471.     sldQuality.LargeChange = (DVBUFFERQUALITY_MAX - DVBUFFERQUALITY_MIN) \ 10
  472.     sldQuality.TickFrequency = sldQuality.LargeChange
  473.     
  474.     sldSensitivity.Min = DVTHRESHOLD_MIN
  475.     sldSensitivity.Max = DVTHRESHOLD_MAX
  476.     sldSensitivity.LargeChange = (DVTHRESHOLD_MAX - DVTHRESHOLD_MIN) \ 10
  477.     sldSensitivity.TickFrequency = sldSensitivity.LargeChange
  478.     
  479.     Dim lCount As Long, oData As DVCOMPRESSIONINFO
  480.     
  481.     If (dvServer Is Nothing) Then Set dvServer = dx.DirectPlayVoiceServerCreate
  482.     For lCount = 1 To dvServer.GetCompressionTypeCount
  483.         dvServer.GetCompressionType lCount, oData, 0
  484.         cboCompressionTypes.AddItem oData.strName
  485.         If InStr(oData.strName, "sc03") Then
  486.             lIndex = lCount - 1
  487.         End If
  488.     Next
  489.     cboCompressionTypes.ListIndex = lIndex
  490.     
  491. End Sub
  492.  
  493. Private Sub optRecordAuto_Click()
  494.     If optRecordAuto.Value Then
  495.         If optSensitivityDefault.Value Then optnSensitivityAuto.Value = True
  496.     End If
  497. End Sub
  498.  
  499. Private Sub optSensitivityDefault_Click()
  500.     If optSensitivityDefault.Value Then
  501.         If optRecordAuto.Value Then optRecordSet.Value = True
  502.     End If
  503. End Sub
  504.  
  505. Private Sub optSensitivitySet_Click()
  506.     If optSensitivitySet.Value = True Then
  507.         optRecordDefault.Value = True
  508.     End If
  509. End Sub
  510.